﻿<UserControl x:Class="WcfClientGenerator.UI.UserControls.ProjectSelectionView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ctl="clr-namespace:WcfClientGenerator.UI.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="350" d:DesignWidth="450" >
    <Grid>
        <Grid.Background>
            <SolidColorBrush Color="LightGray" Opacity="0.5" />
        </Grid.Background>
        <Grid Height="350" Width="450" 
              HorizontalAlignment="Center" VerticalAlignment="Center">
            <Border BorderThickness="0" CornerRadius="5" BorderBrush="Black" Margin="25">
                <Border.Effect>
                    <DropShadowEffect BlurRadius="10" ShadowDepth="5" />
                </Border.Effect>
                <Grid Margin="8"
                      Style="{DynamicResource rootLayoutStyle}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <TextBlock x:Name="txtTitle" Grid.Row="0"
                               Text="Select Projects" 
                               Style="{DynamicResource titleStyle}"/>
                    
                    <ListBox x:Name="lbProjects" Grid.Row="1"
                      Margin="4,4,8,4"
                      Style="{DynamicResource projectListStyle}"
                      ItemsSource="{Binding Path=SelectedProjects}"
                      ScrollViewer.VerticalScrollBarVisibility="Auto" 
                      ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <CheckBox IsChecked="{Binding Path=IsSelected}" VerticalAlignment="Center" Margin="4,2,4,0" />
                                    <TextBlock Text="{Binding Path=ProjectName}" VerticalAlignment="Center" Margin="0,2,0,0" />
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    <StackPanel x:Name="pnlCommands" Grid.Row="2"
                        Margin="4"
                        Orientation="Horizontal" HorizontalAlignment="Right">
                        <Grid Margin="4">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <ctl:ImageButton x:Name="btnOk" 
                                Margin="0,0,0,2" 
                                HorizontalAlignment="Center"
                                Command="{Binding Path=ConfirmProjectSelectionCommand}"
                                ToolTip="OK"
                                Style="{DynamicResource roundButtonStyle}"
                                NormalImage="/WcfClientGenerator.UI.v2;component/Images/check_black.png"
                                HoverImage="/WcfClientGenerator.UI.v2;component/Images/check_white.png"
                                PressedImage="/WcfClientGenerator.UI.v2;component/Images/check_darkgrey.png"
                                DisabledImage="/WcfClientGenerator.UI.v2;component/Images/check_grey.png" />
                            <TextBlock 
                                Grid.Row="1"
                                Style="{DynamicResource buttonLabelStyle}"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Text="OK" />
                        </Grid>

                        <Grid Margin="4">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <ctl:ImageButton x:Name="btnCancel" 
                                Margin="0,0,0,2" 
                                HorizontalAlignment="Center"
                                Command="{Binding Path=CancelProjectSelectionCommand}"
                                ToolTip="Cancel"
                                Style="{DynamicResource roundButtonStyle}"
                                NormalImage="/WcfClientGenerator.UI.v2;component/Images/cancel_black.png"
                                HoverImage="/WcfClientGenerator.UI.v2;component/Images/cancel_white.png"
                                PressedImage="/WcfClientGenerator.UI.v2;component/Images/cancel_darkgrey.png"
                                DisabledImage="/WcfClientGenerator.UI.v2;component/Images/cancel_grey.png" />
                            <TextBlock 
                                Grid.Row="1"
                                Style="{DynamicResource buttonLabelStyle}"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Text="Cancel" />
                        </Grid>
                    </StackPanel>
                </Grid>
            </Border>
        </Grid>
    </Grid>
</UserControl>
